package com.github.bridge.handler;

import cn.hutool.extra.spring.SpringUtil;
import com.github.bridge.request.*;
import com.github.bridge.response.*;
import com.timevale.esign.paas.tech.bean.request.QueryAccountInfoParam;
import com.timevale.esign.paas.tech.bean.result.AccountInfoResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RequiredArgsConstructor
public class BridgeHandler {

    public IServiceHandler chooseHandler() {
        // 后面这里可以根据配置的权重选择
        return SpringUtil.getBean(ESignHandler.class);
    }

    public CreateOuterOrgVO createOuterOrg(CreateOuterOrgDTO dto) {
        return chooseHandler().createOuterOrg(dto);
    }

    public CreateOuterUserVO createOuterUser(CreateOuterUserDTO dto) {
        return chooseHandler().createOuterUser(dto);
    }

    public BaseVO deleteOuterUser(DeleteOuterUserDTO dto) {
        return chooseHandler().deleteOuterUser(dto);
    }

    public CreateOuterOrgSealVO createOuterOrgSeal(CreateOuterOrgSealDTO dto) {
        return chooseHandler().createOuterOrgSeal(dto);
    }

    public CreateOuterUserSealVO createOuterUserSeal(CreateOuterUserSealDTO dto) {
        return chooseHandler().createOuterUserSeal(dto);
    }

    public CreateUserAndSealVO createUserAndSeal(CreateUserAndSealDTO dto) {
        return chooseHandler().createUserAndSeal(dto);
    }

    public OuterUserSignatureVO outerUserSignature(OuterUserSignatureDTO dto) {
        return chooseHandler().outerUserSignature(dto);
    }

    public InnerSignatureVO innerSignature(InnerSignatureDTO dto) {
        return chooseHandler().innerSignature(dto);
    }

    public SignDetailVO signDetail(SignDetailDTO dto) {
        return chooseHandler().signDetail(dto);
    }

    public OuterUserSignatureVO outerUserCreateAndSignature(OuterUserCreateAndSignatureDTO dto) {
        return chooseHandler().outerUserCreateAndSignature(dto);
    }

    public CreateOrgAndSealVO createOrgAndSeal(CreateOrgAndSealDTO dto) {
        return chooseHandler().createOrgAndSeal(dto);
    }

    public OuterOrgSignatureVO outerOrgSignature(OuterUserSignatureDTO dto) {
        return chooseHandler().outerOrgSignature(dto);
    }

    public AccountInfoResult getAccountInfo(QueryAccountInfoParam dto) {
        return chooseHandler().getAccountInfo(dto);
    }
}
